package GUI;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

public class Success extends JFrame {

	private JPanel contentPane;
	private Print p;

	/**
	 * Create the frame.
	 */
	public Success(String s, boolean print) {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 280, 120);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		
		
		if(s.equals("mng"))
		{
			JLabel lblPrintOrNot = new JLabel("Successfully saved");
			lblPrintOrNot.setFont(new Font("Tahoma", Font.PLAIN, 13));
			lblPrintOrNot.setBounds(52, 10, 160, 15);
			contentPane.add(lblPrintOrNot);
		}
		else
		{
			JLabel lblPrintOrNot = new JLabel("Successfully added");
			lblPrintOrNot.setFont(new Font("Tahoma", Font.PLAIN, 13));
			lblPrintOrNot.setBounds(52, 10, 160, 15);
			contentPane.add(lblPrintOrNot);
		}
		
		
		JButton btnYes = new JButton("OK");
		if(print)
		{
			btnYes.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent e) {
					p = new Print();
					p.setVisible(true);
					dispose();
				}
			});		
		}
		else
		{
			btnYes.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent e) {
					MainMenu.getInstance().setVisible(true);
					dispose();
				}
			});		
		}
		
		
		btnYes.setBounds(87, 47, 89, 23);
		contentPane.add(btnYes);
	}

}
